package org.climber.dao;

import org.climber.pojo.Book;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository("bookDao")
public class BookDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    public List<Book> query(String sql, Object[] args) {
        return jdbcTemplate.query(sql, new BeanPropertyRowMapper<Book>(Book.class), args);
    }

    public int update(String sql, Object[] args) {
        return jdbcTemplate.update(sql, args);
    }
}

